using System;
using System.IO;
using QFramework.Framework.Util;
using UnityEditor;
using UnityEngine;

namespace QFramework.Framework.Editor
{
    /**
     * 导出器
     */
    public class Exporter
    {
#if UNITY_EDITOR
        [MenuItem("QFramework/Framework/Editor/导出 UnityPackage %e", false, 1)]
        private static void MenuClicked()
        {
            var generatePackageName = GenerateUnityPackageName();
            EditorUtil.ExportPackage("Assets/QFramework", generatePackageName + ".unitypackage");
            EditorUtil.OpenInFolder(Path
                .Combine(Application.dataPath, "../"));
        }
#endif

        public static string GenerateUnityPackageName()
        {
            return "QFramework_" + DateTime.Now.ToString("yyyyMMdd_HH");
        }
    }
}